package com.lemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@SpringBootApplication
@Controller
public class LemoSpringbootFreemarkerApplication {

	public static void main(String[] args) {
		SpringApplication.run(LemoSpringbootFreemarkerApplication.class, args);
	}

	@RequestMapping("indexWithParam")
	public String indexWithParam(Model model) {
		//
		model.addAttribute("intType", 6);
		model.addAttribute("strType", "中国");
		//
		model.addAttribute("objType", new Man("lemo", 2800.9));

		List<Man> listObj = new ArrayList<>();
		listObj.add(new Man("lemo", 2800.9));
		listObj.add(new Man("lemo1", 32801.9));
		listObj.add(new Man("lemo2", 28002.9));
		listObj.add(new Man("lemo3", 312803.9));
		model.addAttribute("listObj", listObj);
		//
		Map<String, Object> map = new HashMap<>();
		map.put("strType", "6");

		model.addAttribute("map", map);

		return "index01";
	}
}
